package com.kaisu.blog.domain.blog.enums;

import com.kaisu.blog.common.enums.CommonEnum;
import lombok.Getter;

/**
 * @author kaisu
 */
@Getter
public enum BlogStatus implements CommonEnum {
    /**
     * 待发布
     */
    PENDING("0", "待发布"),
    /**
     * 已发布
     */
    PUBLISHED("1", "已发布");
    /**
     * code
     */
    private final String code;
    /**
     * 描述
     */
    private final String description;

    BlogStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public static BlogStatus of(String status) {
        for (BlogStatus value : BlogStatus.values()) {
            if (value.code.equalsIgnoreCase(status)) {
                return value;
            }
        }
        return null;
    }
}